using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows.Forms;

using FreeFlow;
using FreeFlow.Administration;
using FreeFlow.WinFormsControls.HelperClasses;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for FolderControl.
	/// </summary>
	public class FolderControl : AdminUserControl
	{
    private System.Windows.Forms.ToolTip toolTip;
    private ExtendedDataGrid historyGrid;
    private System.Windows.Forms.Panel panel3;
    private System.Windows.Forms.ListView variablesListView;
    private System.Windows.Forms.ColumnHeader columnHeader1;
    private System.Windows.Forms.ColumnHeader columnHeader2;
    private System.Windows.Forms.ListBox watchListBox;
    private System.Windows.Forms.Label label12;
    private System.Windows.Forms.ListBox todoListBox;
    private System.Windows.Forms.Label label11;
    private System.Windows.Forms.PictureBox noParentImage;
    private System.Windows.Forms.TextBox nameLabel;
    private System.Windows.Forms.Label label10;
    private System.Windows.Forms.TextBox parentLabel;
    private System.Windows.Forms.Label label9;
    private System.Windows.Forms.TextBox stageLabel;
    private System.Windows.Forms.Label label8;
    private System.Windows.Forms.TextBox deadlineLabel;
    private System.Windows.Forms.Label label7;
    private System.Windows.Forms.TextBox updatedLabel;
    private System.Windows.Forms.Label label6;
    private System.Windows.Forms.TextBox createdLabel;
    private System.Windows.Forms.Label label5;
    private System.Windows.Forms.NumericUpDown priorityLabel;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.TextBox originatorLabel;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.TextBox subjectLabel;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox folderIdLabel;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label13;
    private System.Windows.Forms.TextBox mapLabel;
    private System.Windows.Forms.TabPage historyPage;
    private System.Windows.Forms.TabPage alertsPage;
    private System.Windows.Forms.TabPage variablesPage;
    private System.Windows.Forms.TabPage attachmentPage;
    private System.Windows.Forms.TabPage childrenPage;
    private System.Windows.Forms.TabPage designerLogPage;
    private System.Windows.Forms.Label label14;
    private System.Windows.Forms.TextBox lockedByLabel;
    private System.Windows.Forms.Label label15;
    private System.Windows.Forms.TextBox lockedSinceLabel;
    private System.Windows.Forms.Label label16;
    private System.Windows.Forms.TextBox lockedActionLabel;
    private System.Windows.Forms.TabPage waitingForPage;
    private System.Windows.Forms.Panel panel5;
    private System.Windows.Forms.Label label17;
    private System.Windows.Forms.Label label18;
    private ExtendedDataGrid timerGrid;
    private ExtendedDataGrid flagGrid;
    private FreeFlowAdministrator.AttachmentsControl attachmentsControl;
    private System.Windows.Forms.Label label19;
    private System.Windows.Forms.Label alertMessageLabel;
    private System.Windows.Forms.Label label20;
    private System.Windows.Forms.TextBox categoryTextBox;
    private System.Windows.Forms.TabControl tabControl;
    private FreeFlowAdministrator.DesignerLogControl designerLogControl;
    private System.Windows.Forms.TabPage notesTabPage;
    private ExtendedDataGrid notesGrid;
    private System.Windows.Forms.Label label21;
    private System.Windows.Forms.TextBox entryTimeLabel;
    private FreeFlowAdministrator.FoldersControl childFolders;
    private FreeFlowAdministrator.UIActionsControl uiActionsControl;
    private System.Windows.Forms.Label label22;
    private System.Windows.Forms.ListBox otherListBox;
    private System.Windows.Forms.Button moveToDoToWatchButton;
    private System.Windows.Forms.Button removeToDoButton;
    private System.Windows.Forms.Button moveWatchToToDoButton;
    private System.Windows.Forms.Button removeWatchButton;
    private System.Windows.Forms.Button addWatchButton;
    private System.Windows.Forms.Button addToDoButton;
    private System.Windows.Forms.CheckBox archivedCheckBox;
    private System.ComponentModel.IContainer components;

		public FolderControl()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

      Application.Idle +=new EventHandler(Application_Idle);
		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
      Application.Idle -= new EventHandler(Application_Idle);
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
      this.components = new System.ComponentModel.Container();
      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FolderControl));
      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
      this.noParentImage = new System.Windows.Forms.PictureBox();
      this.moveToDoToWatchButton = new System.Windows.Forms.Button();
      this.removeToDoButton = new System.Windows.Forms.Button();
      this.removeWatchButton = new System.Windows.Forms.Button();
      this.moveWatchToToDoButton = new System.Windows.Forms.Button();
      this.addWatchButton = new System.Windows.Forms.Button();
      this.addToDoButton = new System.Windows.Forms.Button();
      this.historyGrid = new FreeFlowAdministrator.ExtendedDataGrid();
      this.panel3 = new System.Windows.Forms.Panel();
      this.archivedCheckBox = new System.Windows.Forms.CheckBox();
      this.entryTimeLabel = new System.Windows.Forms.TextBox();
      this.label21 = new System.Windows.Forms.Label();
      this.categoryTextBox = new System.Windows.Forms.TextBox();
      this.label20 = new System.Windows.Forms.Label();
      this.lockedActionLabel = new System.Windows.Forms.TextBox();
      this.label16 = new System.Windows.Forms.Label();
      this.lockedSinceLabel = new System.Windows.Forms.TextBox();
      this.label15 = new System.Windows.Forms.Label();
      this.lockedByLabel = new System.Windows.Forms.TextBox();
      this.label14 = new System.Windows.Forms.Label();
      this.mapLabel = new System.Windows.Forms.TextBox();
      this.label13 = new System.Windows.Forms.Label();
      this.nameLabel = new System.Windows.Forms.TextBox();
      this.label10 = new System.Windows.Forms.Label();
      this.parentLabel = new System.Windows.Forms.TextBox();
      this.label9 = new System.Windows.Forms.Label();
      this.stageLabel = new System.Windows.Forms.TextBox();
      this.label8 = new System.Windows.Forms.Label();
      this.deadlineLabel = new System.Windows.Forms.TextBox();
      this.label7 = new System.Windows.Forms.Label();
      this.updatedLabel = new System.Windows.Forms.TextBox();
      this.label6 = new System.Windows.Forms.Label();
      this.createdLabel = new System.Windows.Forms.TextBox();
      this.label5 = new System.Windows.Forms.Label();
      this.priorityLabel = new System.Windows.Forms.NumericUpDown();
      this.label4 = new System.Windows.Forms.Label();
      this.originatorLabel = new System.Windows.Forms.TextBox();
      this.label3 = new System.Windows.Forms.Label();
      this.pictureBox1 = new System.Windows.Forms.PictureBox();
      this.subjectLabel = new System.Windows.Forms.TextBox();
      this.label2 = new System.Windows.Forms.Label();
      this.folderIdLabel = new System.Windows.Forms.TextBox();
      this.label1 = new System.Windows.Forms.Label();
      this.variablesListView = new System.Windows.Forms.ListView();
      this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
      this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
      this.watchListBox = new System.Windows.Forms.ListBox();
      this.label12 = new System.Windows.Forms.Label();
      this.todoListBox = new System.Windows.Forms.ListBox();
      this.label11 = new System.Windows.Forms.Label();
      this.tabControl = new System.Windows.Forms.TabControl();
      this.alertsPage = new System.Windows.Forms.TabPage();
      this.otherListBox = new System.Windows.Forms.ListBox();
      this.label22 = new System.Windows.Forms.Label();
      this.alertMessageLabel = new System.Windows.Forms.Label();
      this.label19 = new System.Windows.Forms.Label();
      this.waitingForPage = new System.Windows.Forms.TabPage();
      this.timerGrid = new FreeFlowAdministrator.ExtendedDataGrid();
      this.flagGrid = new FreeFlowAdministrator.ExtendedDataGrid();
      this.panel5 = new System.Windows.Forms.Panel();
      this.label18 = new System.Windows.Forms.Label();
      this.label17 = new System.Windows.Forms.Label();
      this.childrenPage = new System.Windows.Forms.TabPage();
      this.childFolders = new FreeFlowAdministrator.FoldersControl();
      this.variablesPage = new System.Windows.Forms.TabPage();
      this.attachmentPage = new System.Windows.Forms.TabPage();
      this.attachmentsControl = new FreeFlowAdministrator.AttachmentsControl();
      this.designerLogPage = new System.Windows.Forms.TabPage();
      this.designerLogControl = new FreeFlowAdministrator.DesignerLogControl();
      this.historyPage = new System.Windows.Forms.TabPage();
      this.notesTabPage = new System.Windows.Forms.TabPage();
      this.notesGrid = new FreeFlowAdministrator.ExtendedDataGrid();
      this.uiActionsControl = new FreeFlowAdministrator.UIActionsControl();
      ((System.ComponentModel.ISupportInitialize)(this.noParentImage)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.historyGrid)).BeginInit();
      this.panel3.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.priorityLabel)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
      this.tabControl.SuspendLayout();
      this.alertsPage.SuspendLayout();
      this.waitingForPage.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.timerGrid)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.flagGrid)).BeginInit();
      this.panel5.SuspendLayout();
      this.childrenPage.SuspendLayout();
      this.variablesPage.SuspendLayout();
      this.attachmentPage.SuspendLayout();
      this.designerLogPage.SuspendLayout();
      this.historyPage.SuspendLayout();
      this.notesTabPage.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.notesGrid)).BeginInit();
      this.SuspendLayout();
      // 
      // noParentImage
      // 
      this.noParentImage.Image = ((System.Drawing.Image)(resources.GetObject("noParentImage.Image")));
      this.noParentImage.Location = new System.Drawing.Point(72, 192);
      this.noParentImage.Name = "noParentImage";
      this.noParentImage.Size = new System.Drawing.Size(16, 16);
      this.noParentImage.TabIndex = 53;
      this.noParentImage.TabStop = false;
      this.toolTip.SetToolTip(this.noParentImage, "Although the folder has a parent folder ID, the parent folder does not exist");
      this.noParentImage.Visible = false;
      // 
      // moveToDoToWatchButton
      // 
      this.moveToDoToWatchButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.moveToDoToWatchButton.Location = new System.Drawing.Point(72, 32);
      this.moveToDoToWatchButton.Name = "moveToDoToWatchButton";
      this.moveToDoToWatchButton.Size = new System.Drawing.Size(64, 23);
      this.moveToDoToWatchButton.TabIndex = 62;
      this.moveToDoToWatchButton.Text = "> Watch";
      this.toolTip.SetToolTip(this.moveToDoToWatchButton, "Move selected alerts to the Watch list");
      this.moveToDoToWatchButton.Click += new System.EventHandler(this.moveToDoToWatchButton_Click);
      // 
      // removeToDoButton
      // 
      this.removeToDoButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.removeToDoButton.Location = new System.Drawing.Point(136, 32);
      this.removeToDoButton.Name = "removeToDoButton";
      this.removeToDoButton.Size = new System.Drawing.Size(64, 23);
      this.removeToDoButton.TabIndex = 63;
      this.removeToDoButton.Text = "> Remove";
      this.toolTip.SetToolTip(this.removeToDoButton, "Remove the selected alerts from all lists");
      this.removeToDoButton.Click += new System.EventHandler(this.removeToDoButton_Click);
      // 
      // removeWatchButton
      // 
      this.removeWatchButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.removeWatchButton.Location = new System.Drawing.Point(336, 32);
      this.removeWatchButton.Name = "removeWatchButton";
      this.removeWatchButton.Size = new System.Drawing.Size(64, 23);
      this.removeWatchButton.TabIndex = 65;
      this.removeWatchButton.Text = "> Remove";
      this.toolTip.SetToolTip(this.removeWatchButton, "Remove the selected alerts from all lists");
      this.removeWatchButton.Click += new System.EventHandler(this.removeWatchButton_Click);
      // 
      // moveWatchToToDoButton
      // 
      this.moveWatchToToDoButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.moveWatchToToDoButton.Location = new System.Drawing.Point(272, 32);
      this.moveWatchToToDoButton.Name = "moveWatchToToDoButton";
      this.moveWatchToToDoButton.Size = new System.Drawing.Size(64, 23);
      this.moveWatchToToDoButton.TabIndex = 64;
      this.moveWatchToToDoButton.Text = "< To Do";
      this.toolTip.SetToolTip(this.moveWatchToToDoButton, "Move selected alerts to the To Do list");
      this.moveWatchToToDoButton.Click += new System.EventHandler(this.moveWatchToToDoButton_Click);
      // 
      // addWatchButton
      // 
      this.addWatchButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.addWatchButton.Location = new System.Drawing.Point(544, 32);
      this.addWatchButton.Name = "addWatchButton";
      this.addWatchButton.Size = new System.Drawing.Size(64, 23);
      this.addWatchButton.TabIndex = 67;
      this.addWatchButton.Text = "< Watch";
      this.toolTip.SetToolTip(this.addWatchButton, "Move selected alerts to the Watch list");
      this.addWatchButton.Click += new System.EventHandler(this.addWatchButton_Click);
      // 
      // addToDoButton
      // 
      this.addToDoButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.addToDoButton.Location = new System.Drawing.Point(480, 32);
      this.addToDoButton.Name = "addToDoButton";
      this.addToDoButton.Size = new System.Drawing.Size(64, 23);
      this.addToDoButton.TabIndex = 66;
      this.addToDoButton.Text = "< To Do";
      this.toolTip.SetToolTip(this.addToDoButton, "Move selected alerts to the To Do list");
      this.addToDoButton.Click += new System.EventHandler(this.addToDoButton_Click);
      // 
      // historyGrid
      // 
      this.historyGrid.AllowNavigation = false;
      this.historyGrid.CaptionVisible = false;
      this.historyGrid.DataMember = "";
      this.historyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
      this.historyGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
      this.historyGrid.Location = new System.Drawing.Point(0, 0);
      this.historyGrid.Name = "historyGrid";
      this.historyGrid.Size = new System.Drawing.Size(810, 174);
      this.historyGrid.TabIndex = 28;
      // 
      // panel3
      // 
      this.panel3.Controls.Add(this.archivedCheckBox);
      this.panel3.Controls.Add(this.entryTimeLabel);
      this.panel3.Controls.Add(this.label21);
      this.panel3.Controls.Add(this.categoryTextBox);
      this.panel3.Controls.Add(this.label20);
      this.panel3.Controls.Add(this.lockedActionLabel);
      this.panel3.Controls.Add(this.label16);
      this.panel3.Controls.Add(this.lockedSinceLabel);
      this.panel3.Controls.Add(this.label15);
      this.panel3.Controls.Add(this.lockedByLabel);
      this.panel3.Controls.Add(this.label14);
      this.panel3.Controls.Add(this.mapLabel);
      this.panel3.Controls.Add(this.label13);
      this.panel3.Controls.Add(this.noParentImage);
      this.panel3.Controls.Add(this.nameLabel);
      this.panel3.Controls.Add(this.label10);
      this.panel3.Controls.Add(this.parentLabel);
      this.panel3.Controls.Add(this.label9);
      this.panel3.Controls.Add(this.stageLabel);
      this.panel3.Controls.Add(this.label8);
      this.panel3.Controls.Add(this.deadlineLabel);
      this.panel3.Controls.Add(this.label7);
      this.panel3.Controls.Add(this.updatedLabel);
      this.panel3.Controls.Add(this.label6);
      this.panel3.Controls.Add(this.createdLabel);
      this.panel3.Controls.Add(this.label5);
      this.panel3.Controls.Add(this.priorityLabel);
      this.panel3.Controls.Add(this.label4);
      this.panel3.Controls.Add(this.originatorLabel);
      this.panel3.Controls.Add(this.label3);
      this.panel3.Controls.Add(this.pictureBox1);
      this.panel3.Controls.Add(this.subjectLabel);
      this.panel3.Controls.Add(this.label2);
      this.panel3.Controls.Add(this.folderIdLabel);
      this.panel3.Controls.Add(this.label1);
      this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
      this.panel3.Location = new System.Drawing.Point(0, 0);
      this.panel3.Name = "panel3";
      this.panel3.Size = new System.Drawing.Size(818, 320);
      this.panel3.TabIndex = 32;
      // 
      // archivedCheckBox
      // 
      this.archivedCheckBox.Enabled = false;
      this.archivedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this.archivedCheckBox.Location = new System.Drawing.Point(8, 296);
      this.archivedCheckBox.Name = "archivedCheckBox";
      this.archivedCheckBox.Size = new System.Drawing.Size(144, 16);
      this.archivedCheckBox.TabIndex = 76;
      this.archivedCheckBox.Text = "Archived?";
      // 
      // entryTimeLabel
      // 
      this.entryTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.entryTimeLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.entryTimeLabel.Location = new System.Drawing.Point(88, 128);
      this.entryTimeLabel.Name = "entryTimeLabel";
      this.entryTimeLabel.ReadOnly = true;
      this.entryTimeLabel.Size = new System.Drawing.Size(720, 13);
      this.entryTimeLabel.TabIndex = 75;
      this.entryTimeLabel.Text = "entryTimeLabel";
      // 
      // label21
      // 
      this.label21.Location = new System.Drawing.Point(8, 128);
      this.label21.Name = "label21";
      this.label21.Size = new System.Drawing.Size(72, 16);
      this.label21.TabIndex = 74;
      this.label21.Text = "Entry time:";
      // 
      // categoryTextBox
      // 
      this.categoryTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.categoryTextBox.Location = new System.Drawing.Point(88, 272);
      this.categoryTextBox.Name = "categoryTextBox";
      this.categoryTextBox.Size = new System.Drawing.Size(720, 20);
      this.categoryTextBox.TabIndex = 72;
      this.categoryTextBox.Text = "categoryTextBox";
      // 
      // label20
      // 
      this.label20.Location = new System.Drawing.Point(8, 272);
      this.label20.Name = "label20";
      this.label20.Size = new System.Drawing.Size(56, 16);
      this.label20.TabIndex = 71;
      this.label20.Text = "Category:";
      // 
      // lockedActionLabel
      // 
      this.lockedActionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.lockedActionLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.lockedActionLabel.Location = new System.Drawing.Point(88, 256);
      this.lockedActionLabel.Name = "lockedActionLabel";
      this.lockedActionLabel.ReadOnly = true;
      this.lockedActionLabel.Size = new System.Drawing.Size(720, 13);
      this.lockedActionLabel.TabIndex = 68;
      this.lockedActionLabel.Text = "lockedActionLabel";
      // 
      // label16
      // 
      this.label16.Location = new System.Drawing.Point(8, 256);
      this.label16.Name = "label16";
      this.label16.Size = new System.Drawing.Size(80, 16);
      this.label16.TabIndex = 67;
      this.label16.Text = "Locked action:";
      // 
      // lockedSinceLabel
      // 
      this.lockedSinceLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.lockedSinceLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.lockedSinceLabel.Location = new System.Drawing.Point(88, 240);
      this.lockedSinceLabel.Name = "lockedSinceLabel";
      this.lockedSinceLabel.ReadOnly = true;
      this.lockedSinceLabel.Size = new System.Drawing.Size(720, 13);
      this.lockedSinceLabel.TabIndex = 66;
      this.lockedSinceLabel.Text = "lockedSinceLabel";
      // 
      // label15
      // 
      this.label15.Location = new System.Drawing.Point(8, 240);
      this.label15.Name = "label15";
      this.label15.Size = new System.Drawing.Size(80, 16);
      this.label15.TabIndex = 65;
      this.label15.Text = "Locked since:";
      // 
      // lockedByLabel
      // 
      this.lockedByLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.lockedByLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.lockedByLabel.Location = new System.Drawing.Point(88, 224);
      this.lockedByLabel.Name = "lockedByLabel";
      this.lockedByLabel.ReadOnly = true;
      this.lockedByLabel.Size = new System.Drawing.Size(720, 13);
      this.lockedByLabel.TabIndex = 64;
      this.lockedByLabel.Text = "lockedByLabel";
      // 
      // label14
      // 
      this.label14.Location = new System.Drawing.Point(8, 224);
      this.label14.Name = "label14";
      this.label14.Size = new System.Drawing.Size(64, 16);
      this.label14.TabIndex = 63;
      this.label14.Text = "Locked by:";
      // 
      // mapLabel
      // 
      this.mapLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.mapLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.mapLabel.Location = new System.Drawing.Point(88, 208);
      this.mapLabel.Name = "mapLabel";
      this.mapLabel.ReadOnly = true;
      this.mapLabel.Size = new System.Drawing.Size(720, 13);
      this.mapLabel.TabIndex = 62;
      this.mapLabel.Text = "mapLabel";
      // 
      // label13
      // 
      this.label13.Location = new System.Drawing.Point(8, 208);
      this.label13.Name = "label13";
      this.label13.Size = new System.Drawing.Size(64, 16);
      this.label13.TabIndex = 61;
      this.label13.Text = "Map:";
      // 
      // nameLabel
      // 
      this.nameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.nameLabel.BackColor = System.Drawing.SystemColors.Window;
      this.nameLabel.Location = new System.Drawing.Point(88, 8);
      this.nameLabel.Name = "nameLabel";
      this.nameLabel.Size = new System.Drawing.Size(680, 20);
      this.nameLabel.TabIndex = 52;
      this.nameLabel.Text = "nameLabel";
      // 
      // label10
      // 
      this.label10.Location = new System.Drawing.Point(8, 10);
      this.label10.Name = "label10";
      this.label10.Size = new System.Drawing.Size(40, 16);
      this.label10.TabIndex = 51;
      this.label10.Text = "Name:";
      // 
      // parentLabel
      // 
      this.parentLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.parentLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.parentLabel.Location = new System.Drawing.Point(88, 192);
      this.parentLabel.Name = "parentLabel";
      this.parentLabel.ReadOnly = true;
      this.parentLabel.Size = new System.Drawing.Size(720, 13);
      this.parentLabel.TabIndex = 49;
      this.parentLabel.Text = "parentLabel";
      // 
      // label9
      // 
      this.label9.Location = new System.Drawing.Point(8, 192);
      this.label9.Name = "label9";
      this.label9.Size = new System.Drawing.Size(48, 16);
      this.label9.TabIndex = 48;
      this.label9.Text = "Parent:";
      // 
      // stageLabel
      // 
      this.stageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.stageLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.stageLabel.Location = new System.Drawing.Point(88, 176);
      this.stageLabel.Name = "stageLabel";
      this.stageLabel.ReadOnly = true;
      this.stageLabel.Size = new System.Drawing.Size(720, 13);
      this.stageLabel.TabIndex = 47;
      this.stageLabel.Text = "stageLabel";
      // 
      // label8
      // 
      this.label8.Location = new System.Drawing.Point(8, 176);
      this.label8.Name = "label8";
      this.label8.Size = new System.Drawing.Size(40, 16);
      this.label8.TabIndex = 46;
      this.label8.Text = "Stage:";
      // 
      // deadlineLabel
      // 
      this.deadlineLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.deadlineLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.deadlineLabel.Location = new System.Drawing.Point(88, 160);
      this.deadlineLabel.Name = "deadlineLabel";
      this.deadlineLabel.ReadOnly = true;
      this.deadlineLabel.Size = new System.Drawing.Size(720, 13);
      this.deadlineLabel.TabIndex = 45;
      this.deadlineLabel.Text = "deadlineLabel";
      // 
      // label7
      // 
      this.label7.Location = new System.Drawing.Point(8, 160);
      this.label7.Name = "label7";
      this.label7.Size = new System.Drawing.Size(56, 16);
      this.label7.TabIndex = 44;
      this.label7.Text = "Deadline:";
      // 
      // updatedLabel
      // 
      this.updatedLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.updatedLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.updatedLabel.Location = new System.Drawing.Point(88, 144);
      this.updatedLabel.Name = "updatedLabel";
      this.updatedLabel.ReadOnly = true;
      this.updatedLabel.Size = new System.Drawing.Size(720, 13);
      this.updatedLabel.TabIndex = 43;
      this.updatedLabel.Text = "updatedLabel";
      // 
      // label6
      // 
      this.label6.Location = new System.Drawing.Point(8, 144);
      this.label6.Name = "label6";
      this.label6.Size = new System.Drawing.Size(80, 16);
      this.label6.TabIndex = 42;
      this.label6.Text = "Last updated:";
      // 
      // createdLabel
      // 
      this.createdLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.createdLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.createdLabel.Location = new System.Drawing.Point(88, 112);
      this.createdLabel.Name = "createdLabel";
      this.createdLabel.ReadOnly = true;
      this.createdLabel.Size = new System.Drawing.Size(720, 13);
      this.createdLabel.TabIndex = 41;
      this.createdLabel.Text = "createdLabel";
      // 
      // label5
      // 
      this.label5.Location = new System.Drawing.Point(8, 112);
      this.label5.Name = "label5";
      this.label5.Size = new System.Drawing.Size(48, 16);
      this.label5.TabIndex = 40;
      this.label5.Text = "Created:";
      // 
      // priorityLabel
      // 
      this.priorityLabel.Location = new System.Drawing.Point(88, 88);
      this.priorityLabel.Maximum = new decimal(new int[] {
            9,
            0,
            0,
            0});
      this.priorityLabel.Name = "priorityLabel";
      this.priorityLabel.Size = new System.Drawing.Size(64, 20);
      this.priorityLabel.TabIndex = 39;
      this.priorityLabel.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
      // 
      // label4
      // 
      this.label4.Location = new System.Drawing.Point(8, 90);
      this.label4.Name = "label4";
      this.label4.Size = new System.Drawing.Size(48, 16);
      this.label4.TabIndex = 38;
      this.label4.Text = "Priority:";
      // 
      // originatorLabel
      // 
      this.originatorLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.originatorLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.originatorLabel.Location = new System.Drawing.Point(88, 72);
      this.originatorLabel.Name = "originatorLabel";
      this.originatorLabel.ReadOnly = true;
      this.originatorLabel.Size = new System.Drawing.Size(720, 13);
      this.originatorLabel.TabIndex = 37;
      this.originatorLabel.Text = "originatorLabel";
      // 
      // label3
      // 
      this.label3.Location = new System.Drawing.Point(8, 72);
      this.label3.Name = "label3";
      this.label3.Size = new System.Drawing.Size(64, 16);
      this.label3.TabIndex = 36;
      this.label3.Text = "Originator:";
      // 
      // pictureBox1
      // 
      this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
      this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
      this.pictureBox1.Location = new System.Drawing.Point(776, 8);
      this.pictureBox1.Name = "pictureBox1";
      this.pictureBox1.Size = new System.Drawing.Size(32, 32);
      this.pictureBox1.TabIndex = 35;
      this.pictureBox1.TabStop = false;
      // 
      // subjectLabel
      // 
      this.subjectLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.subjectLabel.Location = new System.Drawing.Point(88, 48);
      this.subjectLabel.Name = "subjectLabel";
      this.subjectLabel.Size = new System.Drawing.Size(720, 20);
      this.subjectLabel.TabIndex = 34;
      this.subjectLabel.Text = "subjectLabel";
      // 
      // label2
      // 
      this.label2.Location = new System.Drawing.Point(8, 50);
      this.label2.Name = "label2";
      this.label2.Size = new System.Drawing.Size(48, 16);
      this.label2.TabIndex = 33;
      this.label2.Text = "Subject:";
      // 
      // folderIdLabel
      // 
      this.folderIdLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.folderIdLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.folderIdLabel.Location = new System.Drawing.Point(88, 32);
      this.folderIdLabel.Name = "folderIdLabel";
      this.folderIdLabel.ReadOnly = true;
      this.folderIdLabel.Size = new System.Drawing.Size(680, 13);
      this.folderIdLabel.TabIndex = 32;
      this.folderIdLabel.Text = "folderIdLabel";
      // 
      // label1
      // 
      this.label1.Location = new System.Drawing.Point(8, 32);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(56, 16);
      this.label1.TabIndex = 31;
      this.label1.Text = "Folder ID:";
      // 
      // variablesListView
      // 
      this.variablesListView.BackColor = System.Drawing.SystemColors.Control;
      this.variablesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2});
      this.variablesListView.Dock = System.Windows.Forms.DockStyle.Fill;
      this.variablesListView.FullRowSelect = true;
      this.variablesListView.Location = new System.Drawing.Point(0, 0);
      this.variablesListView.Name = "variablesListView";
      this.variablesListView.Size = new System.Drawing.Size(810, 174);
      this.variablesListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
      this.variablesListView.TabIndex = 59;
      this.variablesListView.UseCompatibleStateImageBehavior = false;
      this.variablesListView.View = System.Windows.Forms.View.Details;
      // 
      // columnHeader1
      // 
      this.columnHeader1.Text = "Name";
      this.columnHeader1.Width = 200;
      // 
      // columnHeader2
      // 
      this.columnHeader2.Text = "Value";
      this.columnHeader2.Width = 200;
      // 
      // watchListBox
      // 
      this.watchListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                  | System.Windows.Forms.AnchorStyles.Left)));
      this.watchListBox.BackColor = System.Drawing.SystemColors.Control;
      this.watchListBox.Location = new System.Drawing.Point(208, 56);
      this.watchListBox.Name = "watchListBox";
      this.watchListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
      this.watchListBox.Size = new System.Drawing.Size(192, 108);
      this.watchListBox.TabIndex = 57;
      // 
      // label12
      // 
      this.label12.Location = new System.Drawing.Point(208, 32);
      this.label12.Name = "label12";
      this.label12.Size = new System.Drawing.Size(56, 16);
      this.label12.TabIndex = 56;
      this.label12.Text = "Watch list";
      // 
      // todoListBox
      // 
      this.todoListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                  | System.Windows.Forms.AnchorStyles.Left)));
      this.todoListBox.BackColor = System.Drawing.SystemColors.Control;
      this.todoListBox.Location = new System.Drawing.Point(8, 56);
      this.todoListBox.Name = "todoListBox";
      this.todoListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
      this.todoListBox.Size = new System.Drawing.Size(192, 108);
      this.todoListBox.TabIndex = 55;
      // 
      // label11
      // 
      this.label11.Location = new System.Drawing.Point(8, 32);
      this.label11.Name = "label11";
      this.label11.Size = new System.Drawing.Size(64, 16);
      this.label11.TabIndex = 54;
      this.label11.Text = "To Do list";
      // 
      // tabControl
      // 
      this.tabControl.Controls.Add(this.alertsPage);
      this.tabControl.Controls.Add(this.waitingForPage);
      this.tabControl.Controls.Add(this.childrenPage);
      this.tabControl.Controls.Add(this.variablesPage);
      this.tabControl.Controls.Add(this.attachmentPage);
      this.tabControl.Controls.Add(this.designerLogPage);
      this.tabControl.Controls.Add(this.historyPage);
      this.tabControl.Controls.Add(this.notesTabPage);
      this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
      this.tabControl.Location = new System.Drawing.Point(0, 320);
      this.tabControl.Name = "tabControl";
      this.tabControl.SelectedIndex = 0;
      this.tabControl.Size = new System.Drawing.Size(818, 200);
      this.tabControl.TabIndex = 63;
      this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
      // 
      // alertsPage
      // 
      this.alertsPage.Controls.Add(this.addWatchButton);
      this.alertsPage.Controls.Add(this.addToDoButton);
      this.alertsPage.Controls.Add(this.removeWatchButton);
      this.alertsPage.Controls.Add(this.moveWatchToToDoButton);
      this.alertsPage.Controls.Add(this.removeToDoButton);
      this.alertsPage.Controls.Add(this.moveToDoToWatchButton);
      this.alertsPage.Controls.Add(this.otherListBox);
      this.alertsPage.Controls.Add(this.label22);
      this.alertsPage.Controls.Add(this.alertMessageLabel);
      this.alertsPage.Controls.Add(this.label19);
      this.alertsPage.Controls.Add(this.todoListBox);
      this.alertsPage.Controls.Add(this.label11);
      this.alertsPage.Controls.Add(this.watchListBox);
      this.alertsPage.Controls.Add(this.label12);
      this.alertsPage.Location = new System.Drawing.Point(4, 22);
      this.alertsPage.Name = "alertsPage";
      this.alertsPage.Size = new System.Drawing.Size(810, 174);
      this.alertsPage.TabIndex = 1;
      this.alertsPage.Text = "Alerts";
      // 
      // otherListBox
      // 
      this.otherListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                  | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.otherListBox.BackColor = System.Drawing.SystemColors.Control;
      this.otherListBox.Location = new System.Drawing.Point(408, 56);
      this.otherListBox.Name = "otherListBox";
      this.otherListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
      this.otherListBox.Size = new System.Drawing.Size(392, 108);
      this.otherListBox.TabIndex = 61;
      // 
      // label22
      // 
      this.label22.Location = new System.Drawing.Point(408, 32);
      this.label22.Name = "label22";
      this.label22.Size = new System.Drawing.Size(64, 16);
      this.label22.TabIndex = 60;
      this.label22.Text = "Other users";
      // 
      // alertMessageLabel
      // 
      this.alertMessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.alertMessageLabel.Location = new System.Drawing.Point(88, 8);
      this.alertMessageLabel.Name = "alertMessageLabel";
      this.alertMessageLabel.Size = new System.Drawing.Size(714, 16);
      this.alertMessageLabel.TabIndex = 59;
      this.alertMessageLabel.Text = "alertMessageLabel";
      // 
      // label19
      // 
      this.label19.Location = new System.Drawing.Point(8, 8);
      this.label19.Name = "label19";
      this.label19.Size = new System.Drawing.Size(80, 16);
      this.label19.TabIndex = 58;
      this.label19.Text = "Alert message:";
      // 
      // waitingForPage
      // 
      this.waitingForPage.Controls.Add(this.timerGrid);
      this.waitingForPage.Controls.Add(this.flagGrid);
      this.waitingForPage.Controls.Add(this.panel5);
      this.waitingForPage.Location = new System.Drawing.Point(4, 22);
      this.waitingForPage.Name = "waitingForPage";
      this.waitingForPage.Size = new System.Drawing.Size(810, 174);
      this.waitingForPage.TabIndex = 6;
      this.waitingForPage.Text = "Waiting for";
      // 
      // timerGrid
      // 
      this.timerGrid.AllowNavigation = false;
      this.timerGrid.CaptionVisible = false;
      this.timerGrid.DataMember = "";
      this.timerGrid.Dock = System.Windows.Forms.DockStyle.Fill;
      this.timerGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
      this.timerGrid.Location = new System.Drawing.Point(344, 32);
      this.timerGrid.Name = "timerGrid";
      this.timerGrid.Size = new System.Drawing.Size(466, 142);
      this.timerGrid.TabIndex = 2;
      // 
      // flagGrid
      // 
      this.flagGrid.AllowNavigation = false;
      this.flagGrid.CaptionVisible = false;
      this.flagGrid.DataMember = "";
      this.flagGrid.Dock = System.Windows.Forms.DockStyle.Left;
      this.flagGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
      this.flagGrid.Location = new System.Drawing.Point(0, 32);
      this.flagGrid.Name = "flagGrid";
      this.flagGrid.Size = new System.Drawing.Size(344, 142);
      this.flagGrid.TabIndex = 1;
      // 
      // panel5
      // 
      this.panel5.Controls.Add(this.label18);
      this.panel5.Controls.Add(this.label17);
      this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
      this.panel5.Location = new System.Drawing.Point(0, 0);
      this.panel5.Name = "panel5";
      this.panel5.Size = new System.Drawing.Size(810, 32);
      this.panel5.TabIndex = 0;
      // 
      // label18
      // 
      this.label18.Location = new System.Drawing.Point(344, 8);
      this.label18.Name = "label18";
      this.label18.Size = new System.Drawing.Size(100, 23);
      this.label18.TabIndex = 1;
      this.label18.Text = "Timers";
      // 
      // label17
      // 
      this.label17.Location = new System.Drawing.Point(8, 8);
      this.label17.Name = "label17";
      this.label17.Size = new System.Drawing.Size(100, 23);
      this.label17.TabIndex = 0;
      this.label17.Text = "Flags";
      // 
      // childrenPage
      // 
      this.childrenPage.Controls.Add(this.childFolders);
      this.childrenPage.Location = new System.Drawing.Point(4, 22);
      this.childrenPage.Name = "childrenPage";
      this.childrenPage.Size = new System.Drawing.Size(810, 174);
      this.childrenPage.TabIndex = 4;
      this.childrenPage.Text = "Children";
      // 
      // childFolders
      // 
      this.childFolders.ActionsVisible = false;
      this.childFolders.Dock = System.Windows.Forms.DockStyle.Fill;
      this.childFolders.Location = new System.Drawing.Point(0, 0);
      this.childFolders.Name = "childFolders";
      this.childFolders.Size = new System.Drawing.Size(810, 174);
      this.childFolders.TabIndex = 0;
      // 
      // variablesPage
      // 
      this.variablesPage.Controls.Add(this.variablesListView);
      this.variablesPage.Location = new System.Drawing.Point(4, 22);
      this.variablesPage.Name = "variablesPage";
      this.variablesPage.Size = new System.Drawing.Size(810, 174);
      this.variablesPage.TabIndex = 2;
      this.variablesPage.Text = "Variables";
      // 
      // attachmentPage
      // 
      this.attachmentPage.Controls.Add(this.attachmentsControl);
      this.attachmentPage.Location = new System.Drawing.Point(4, 22);
      this.attachmentPage.Name = "attachmentPage";
      this.attachmentPage.Size = new System.Drawing.Size(810, 174);
      this.attachmentPage.TabIndex = 3;
      this.attachmentPage.Text = "Attachments";
      // 
      // attachmentsControl
      // 
      this.attachmentsControl.Dock = System.Windows.Forms.DockStyle.Fill;
      this.attachmentsControl.Location = new System.Drawing.Point(0, 0);
      this.attachmentsControl.Name = "attachmentsControl";
      this.attachmentsControl.Size = new System.Drawing.Size(810, 174);
      this.attachmentsControl.TabIndex = 0;
      // 
      // designerLogPage
      // 
      this.designerLogPage.Controls.Add(this.designerLogControl);
      this.designerLogPage.Location = new System.Drawing.Point(4, 22);
      this.designerLogPage.Name = "designerLogPage";
      this.designerLogPage.Size = new System.Drawing.Size(810, 174);
      this.designerLogPage.TabIndex = 5;
      this.designerLogPage.Text = "Designer Log";
      // 
      // designerLogControl
      // 
      this.designerLogControl.ActionsVisible = false;
      this.designerLogControl.Dock = System.Windows.Forms.DockStyle.Fill;
      this.designerLogControl.Location = new System.Drawing.Point(0, 0);
      this.designerLogControl.Name = "designerLogControl";
      this.designerLogControl.Size = new System.Drawing.Size(810, 174);
      this.designerLogControl.TabIndex = 0;
      // 
      // historyPage
      // 
      this.historyPage.Controls.Add(this.historyGrid);
      this.historyPage.Location = new System.Drawing.Point(4, 22);
      this.historyPage.Name = "historyPage";
      this.historyPage.Size = new System.Drawing.Size(810, 174);
      this.historyPage.TabIndex = 0;
      this.historyPage.Text = "History";
      // 
      // notesTabPage
      // 
      this.notesTabPage.Controls.Add(this.notesGrid);
      this.notesTabPage.Location = new System.Drawing.Point(4, 22);
      this.notesTabPage.Name = "notesTabPage";
      this.notesTabPage.Size = new System.Drawing.Size(810, 174);
      this.notesTabPage.TabIndex = 7;
      this.notesTabPage.Text = "Notes";
      // 
      // notesGrid
      // 
      this.notesGrid.AllowNavigation = false;
      this.notesGrid.CaptionVisible = false;
      this.notesGrid.DataMember = "";
      this.notesGrid.Dock = System.Windows.Forms.DockStyle.Fill;
      this.notesGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
      this.notesGrid.Location = new System.Drawing.Point(0, 0);
      this.notesGrid.Name = "notesGrid";
      this.notesGrid.Size = new System.Drawing.Size(810, 174);
      this.notesGrid.TabIndex = 0;
      // 
      // uiActionsControl
      // 
      this.uiActionsControl.Actions = null;
      this.uiActionsControl.Dock = System.Windows.Forms.DockStyle.Right;
      this.uiActionsControl.Location = new System.Drawing.Point(818, 0);
      this.uiActionsControl.Name = "uiActionsControl";
      this.uiActionsControl.Size = new System.Drawing.Size(150, 520);
      this.uiActionsControl.TabIndex = 64;
      // 
      // FolderControl
      // 
      this.Controls.Add(this.tabControl);
      this.Controls.Add(this.panel3);
      this.Controls.Add(this.uiActionsControl);
      this.Name = "FolderControl";
      this.Size = new System.Drawing.Size(968, 520);
      ((System.ComponentModel.ISupportInitialize)(this.noParentImage)).EndInit();
      ((System.ComponentModel.ISupportInitialize)(this.historyGrid)).EndInit();
      this.panel3.ResumeLayout(false);
      this.panel3.PerformLayout();
      ((System.ComponentModel.ISupportInitialize)(this.priorityLabel)).EndInit();
      ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
      this.tabControl.ResumeLayout(false);
      this.alertsPage.ResumeLayout(false);
      this.waitingForPage.ResumeLayout(false);
      ((System.ComponentModel.ISupportInitialize)(this.timerGrid)).EndInit();
      ((System.ComponentModel.ISupportInitialize)(this.flagGrid)).EndInit();
      this.panel5.ResumeLayout(false);
      this.childrenPage.ResumeLayout(false);
      this.variablesPage.ResumeLayout(false);
      this.attachmentPage.ResumeLayout(false);
      this.designerLogPage.ResumeLayout(false);
      this.historyPage.ResumeLayout(false);
      this.notesTabPage.ResumeLayout(false);
      ((System.ComponentModel.ISupportInitialize)(this.notesGrid)).EndInit();
      this.ResumeLayout(false);

    }
		#endregion

    private Folder folder;
    public void LoadFolder(Folder folder)
    {
      this.folder = folder;
      nameLabel.Text = folder.Name;
      folderIdLabel.Text = folder.FolderId;
      subjectLabel.Text = folder.Subject;
      originatorLabel.Text = folder.Originator;
      priorityLabel.Text = folder.Priority.ToString();
      if (folder.Created == FreeFlow.Constants.NullDateTime)
        createdLabel.Text = string.Empty;
      else
        createdLabel.Text = folder.Created.ToString();
      if (folder.Updated == FreeFlow.Constants.NullDateTime)
        updatedLabel.Text = string.Empty;
      else
        updatedLabel.Text = folder.Updated.ToString();
      if (folder.EntryTime == FreeFlow.Constants.NullDateTime)
        entryTimeLabel.Text = string.Empty;
      else
        entryTimeLabel.Text = folder.EntryTime.ToString();
      if (folder.Deadline == FreeFlow.Constants.NullDateTime)
        deadlineLabel.Text = string.Empty;
      else
        deadlineLabel.Text = folder.Deadline.ToString();
      stageLabel.Text = folder.StageName;
      if (folder.GetParent() == null)
      {
        parentLabel.Text = folder.ParentFolderId;
        if ((folder.ParentFolderId != null) && (folder.ParentFolderId.Trim().Length > 0))
          noParentImage.Visible = true;
      }
      else
        parentLabel.Text = folder.GetParent().Name;
      mapLabel.Text = folder.MapName;
      categoryTextBox.Text = folder.Category;
      archivedCheckBox.Checked = folder.IsArchived;

      // alerts
      LoadAlerts();
    
      // custom variables
      variablesListView.Items.Clear();
      foreach(DictionaryEntry entry in folder.CustomVariables)
      {
        ListViewItem item = new ListViewItem(new string[] {entry.Key.ToString(), entry.Value.ToString()});
        variablesListView.Items.Add(item);
      }

      // lock details
      lockedByLabel.Text = folder.LockedBy;
      if (folder.LockedSince == FreeFlow.Constants.NullDateTime)
        lockedSinceLabel.Text = string.Empty;
      else
        lockedSinceLabel.Text = folder.LockedSince.ToString();
      lockedActionLabel.Text = folder.LockedAction;

      // flags
      flagGrid.DataSource = folder.WaitingForFlags;
      flagGrid.ClearColumns();
      flagGrid.AddColumn("FlagName", "Flag");
      flagGrid.AddColumn("ActionName", "Action");
      flagGrid.AddColumn("FlagFolderId", "Flag folder ID");
      
      // timers
      timerGrid.DataSource = folder.WaitingForTimers;
      timerGrid.ClearColumns();
      timerGrid.AddColumn("Time");
      timerGrid.AddColumn("ActionName", "Action");

      attachmentsControl.LoadAttachments(folder.Attachments);

      ShowCurrentTab();
    }

    private void LoadAlerts()
    {
      todoListBox.DataSource = null;
      watchListBox.DataSource = null;

      alertMessageLabel.Text = folder.AlertMessage;
      
      todoListBox.DataSource = folder.ToDoList;
      if (folder.ToDoList.Count > 0)
      {
        todoListBox.DisplayMember = "UserName";
      }

      watchListBox.DataSource = folder.WatchList;
      if (folder.WatchList.Count > 0)
      {
        watchListBox.DisplayMember = "UserName";
      }

      otherListBox.Items.Clear();
      // add users with deletion alerts
      for (int i = 0; i < folder.DeletionList.Count; i++)
      {
        otherListBox.Items.Add(folder.DeletionList[i]);
      }

      // add other users with no alert
      UserCollection users = folder.Server.Users;
      for (int i = 0; i < users.Count; i++)
      {
        User thisUser = users[i];
        if (!folder.ToDoList.ContainsUser(thisUser.Name) && !folder.WatchList.ContainsUser(thisUser.Name)
          && !folder.DeletionList.ContainsUser(thisUser.Name))
        {
          otherListBox.Items.Add(thisUser.Name);
        }
      }
    }

    private UIActionList actionList;
    public UIActionList ActionList
    {
      get
      {
        return actionList;
      }
    }

    private void ShowActions()
    {
      actionList = new UIActionList();
      actionList.Add("Apply changes", "Apply any changes made", new ActionExecuteDelegate(ApplyChanges));
      actionList.Add("Refresh", "Refresh the data for this folder", new ActionExecuteDelegate(RefreshFolder));
      actionList.Add("Delete", "Delete this folder", new ActionExecuteDelegate(DeleteFolder));
      actionList.Add("Open in client", "Open this folder in the web client (will only work with version 7 and later)", new ActionExecuteDelegate(OpenInEwork));
      if (folder != null)
      {
        if (folder.GetParent() != null)
          actionList.Add("Open parent", "Open this folder's parent", 
            new ActionExecuteDelegate(OpenParent));
        if (folder.IsLocked)
          actionList.Add("Unlock", "Unlock this folder so it can be actioned by another user", 
            new ActionExecuteDelegate(UnlockFolder));
      }

      if (tabControl.SelectedTab == childrenPage)
      {
        actionList.Add("Children");
        actionList.Add(childFolders.ActionList);
      }
      else if (tabControl.SelectedTab == variablesPage)
      {
        actionList.Add("Variables");
        actionList.Add("Copy to clipboard", "Copy the variable names and values to the clipboard", 
          new ActionExecuteDelegate(CopyToClipboard));
      }
      else if (tabControl.SelectedTab == attachmentPage)
      {
        actionList.Add("Attachments");
        actionList.Add(attachmentsControl.ActionList);
      }
      else if (tabControl.SelectedTab == designerLogPage)
      {
        actionList.Add("Designer Log");
        actionList.Add(designerLogControl.ActionList);
      }
      else if (tabControl.SelectedTab == historyPage)
      {
        actionList.Add("History");
        actionList.Add("Copy to clipboard", "Copy the history for this folder to the clipboard", 
          new ActionExecuteDelegate(CopyHistory));
      }
      else if (tabControl.SelectedTab == notesTabPage)
      {
        actionList.Add("Notes");
        actionList.Add("Copy to clipboard", "Copy the notes for this folder to the clipboard", 
          new ActionExecuteDelegate(CopyNotes));
      }
      
      uiActionsControl.Actions = actionList;
      OnActionsChanged();
    }

    private void OnActionsChanged()
    {
      if (ActionsChanged != null)
        ActionsChanged(this, EventArgs.Empty);
    }

    public event EventHandler ActionsChanged;

    private string CopyNotes()
    {
      notesGrid.CopyToClipboard();
      return null;
    }

    private string CopyHistory()
    {
      historyGrid.CopyToClipboard();
      return null;
    }

    private string OpenParent()
    {
      FolderForm folderForm = new FolderForm();
      folderForm.LoadFolder(folder.GetParent());
      folderForm.Show();
      return null;
    }

    private string OpenInEwork()
    {
      folder.OpenInClient(OptionsControl.WebDllLocation(folder.Server.Dsn));
      return null;
    }

    private string UnlockFolder()
    {
      using (new CursorHandler())
      {
        folder.Unlock();
        folder.Refresh();
        LoadFolder(folder);
      }
      return null;
    }

    private string DeleteFolder()
    {
      if (MessageBox.Show("Delete this folder?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
      {
        using (new CursorHandler())
        {
          folder.Delete();
        }
        OnItemDeleted();
        OnActionsChanged();
        Dispose();
      }
      return null;
    }

    private string ApplyChanges()
    {
      using (new CursorHandler())
      {
        folder.Category = categoryTextBox.Text;
        folder.Priority = (int)priorityLabel.Value;
        folder.Subject = subjectLabel.Text;
        folder.Name = nameLabel.Text;
        folder.ApplyChanges();
        return Constants.ChangesApplied;
      }
    }

    private string RefreshFolder()
    {
      folder.Refresh();
      LoadFolder(folder);
      return null;
    }

    private void tabControl_SelectedIndexChanged(object sender, System.EventArgs e)
    {
      ShowCurrentTab();
    }

    private void ShowCurrentTab()
    {
      using (new CursorHandler())
      {
        if (tabControl.SelectedTab == historyPage)
        {
          if (folder != null)
          {
            historyGrid.DataSource = null;
            historyGrid.DataSource = folder.History;
            historyGrid.ClearColumns();
            historyGrid.AddColumn("EventTime", "Event time");
            historyGrid.AddColumn("FromStage", "From stage");
            historyGrid.AddColumn("Action");
            historyGrid.AddColumn("ToStage", "To stage");
            historyGrid.AddColumn("Notes");
            historyGrid.AddColumn("Message");
            historyGrid.AddColumn("User");
            historyGrid.AddColumn("Version");
            historyGrid.AutosizeColumns();
            historyGrid.AutosizeRows();
          }
        }
        else if (tabControl.SelectedTab == designerLogPage)
        {
          if (folder != null)
          {
            designerLogControl.LoadDesignerLog(folder.DesignerLog);
          }
        }
        else if (tabControl.SelectedTab == notesTabPage)
        {
          if (folder != null)
          {
            notesGrid.DataSource = null;
            notesGrid.DataSource = folder.Notes;
            notesGrid.ClearColumns();
            notesGrid.AddColumn("Time");
            notesGrid.AddColumn("Note");
            notesGrid.AddColumn("Action");
            notesGrid.AddColumn("User");
            notesGrid.AutosizeColumns();
            notesGrid.AutosizeRows();
          }
        }
        else if (tabControl.SelectedTab == childrenPage)
        {
          if (folder != null)
            childFolders.LoadFolders(folder.ChildFolders);
        }
        ShowActions();
      }
    }

    private string CopyToClipboard()
    {
      // copy to clipboard
      StringBuilder builder = new StringBuilder();
      for (int i = 0; i < variablesListView.Items.Count; i++)
      {
        builder.Append(variablesListView.Items[i].SubItems[0].Text);
        builder.Append("\t");
        builder.Append(variablesListView.Items[i].SubItems[1].Text);
        builder.Append(Environment.NewLine);
      }

      Clipboard.SetDataObject(builder.ToString(), true);
      return null;
    }

    private void MoveAlerts(ListBox fromList, ListBox toList)
    {
      for (int i = 0; i < fromList.SelectedItems.Count; i++)
      {
        // remove from alert list
        Alert item = null;
        if (fromList.SelectedItems[i] is Alert)
        {
          item = (Alert)fromList.SelectedItems[i];
          AlertCollection fromAlerts;
          if (fromList == otherListBox)
            fromAlerts = folder.DeletionList; 
          else
            fromAlerts = (AlertCollection)fromList.DataSource;
          fromAlerts.Remove(item);
        }

        // add to new alert list
        AlertCollection toAlerts = (AlertCollection)toList.DataSource;
        if (toAlerts != null)
        {
          if (item == null)
            toAlerts.Add(folder, fromList.SelectedItems[i].ToString());
          else
            toAlerts.Add(item);
        }
      }
      LoadAlerts();
    }

    private void moveToDoToWatchButton_Click(object sender, System.EventArgs e)
    {
      MoveAlerts(todoListBox, watchListBox);
    }

    private void moveWatchToToDoButton_Click(object sender, System.EventArgs e)
    {
      MoveAlerts(watchListBox, todoListBox);
    }

    private void removeToDoButton_Click(object sender, System.EventArgs e)
    {
      MoveAlerts(todoListBox, otherListBox);
    }

    private void removeWatchButton_Click(object sender, System.EventArgs e)
    {
      MoveAlerts(watchListBox, otherListBox);
    }

    private void addToDoButton_Click(object sender, System.EventArgs e)
    {
      MoveAlerts(otherListBox, todoListBox);
    }

    private void addWatchButton_Click(object sender, System.EventArgs e)
    {
      MoveAlerts(otherListBox, watchListBox);
    }

    public bool ActionsVisible
    {
      get
      {
        return uiActionsControl.Visible;
      }
      set
      {
        uiActionsControl.Visible = value;
      }
    }

    private void Application_Idle(object sender, EventArgs e)
    {
      moveToDoToWatchButton.Enabled = todoListBox.SelectedItems.Count > 0;
      removeToDoButton.Enabled = todoListBox.SelectedItems.Count > 0;

      moveWatchToToDoButton.Enabled = watchListBox.SelectedItems.Count > 0;
      removeWatchButton.Enabled = watchListBox.SelectedItems.Count > 0;

      addToDoButton.Enabled = otherListBox.SelectedItems.Count > 0;
      addWatchButton.Enabled = otherListBox.SelectedItems.Count > 0;
    }
  }
}
